let config = {
	header: {
		'content-type': 'application/json;charset=UTF-8',
	},
	url: 'https://same.ascetic.top',
}

const install = (Vue, vm) => {
	Vue.prototype.$u.http.setConfig({
		baseUrl: config.url,
	});
	Vue.prototype.$u.http.interceptor.request = (config) => {
		config.header.token = uni.getStorageSync('token')
		// config.header.token = '6b0bb06e-795b-4129-bd2a-c0a659c26600'
		// config.header.token ='a3b6ed59-8a32-442a-99bd-4d05434d12bc'
		// config.header.token ='fe1fac5b-62d5-4069-94e7-7dcf395d327e'
		// config.header.token ='3c3ba409-89ff-44b6-87d9-773496be6fd4'
	}

	Vue.prototype.$u.http.interceptor.response = (res) => {
		if (res.code == 6) {
			uni.$u.toast('请先登录')
			setTimeout(function () {
				uni.reLaunch({
					url: '/liu/pages/login'
				})
			}, 1500);
			return;
		} else if (res.code == 0) {
			// if(res.msg=='门店不存在'){
			// 	uni.redirectTo({
			// 		url:'/yCreate/pages/cooperation'
			// 	})
			// }else{
			// 	return res;
			// }
			return res;

		} else {
			return res;
		}
	}
}
export default {
	install
}